package com.wanbangee.marksystem.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wanbangee.marksystem.service.SubmitTestService;

/**
 * 提交打分试题
 * @author 小粥愚
 *
 */
@RestController
public class SubmitTestController {
	@Autowired
	private SubmitTestService submitTestService;
	
	//
	/**
	 * 问题卷提交
	 * @param examId
	 * @param examSubId
	 * @param teaId
	 * @param topicNo
	 * @param score
	 * @param scoreId
	 * @param recordId	试卷的记录类型（0：正常卷，2：优秀卷，3：典型错误卷）
	 * @param markerId
	 * @param exceptionInfo	问题卷信息（1 图像不完整,2 图像不清晰 ,3 字迹不清晰,4 其他）
	 * @param exceptionRemark 问题卷描述
	 * @return
	 */
	@GetMapping("/exam-score/score/submitProblemTest")
	public Map<String,Object> submitProblemTest(Integer examId,Integer examSubId,Integer teaId,String teaNm,String topicNo,Double score,Integer scoreId,Long recordId,Integer markerId,Long exceptionInfo,String exceptionRemark) {
		
		Map<String,Object> map = new HashMap<>();
		Boolean flag = this.submitTestService.submitProblemTestScore(examId, examSubId, teaId, teaNm,topicNo, score, scoreId, recordId, markerId,exceptionInfo,exceptionRemark);
		if(!flag) {
			map.put("code", 1004);
			map.put("msg", "提交失败");
		}else {
			map.put("code", 1003);
			map.put("msg", "提交成功");
		}
		return map;
	}
	
	/**
	 * 正常卷的提交分数（正常提交）
	 * @param examId
	 * @param examSubId
	 * @param teaId
	 * @param teaNm
	 * @param topicNo
	 * @param score
	 * @param scoreId
	 * @param recordId 试卷的记录类型（0：正常卷，2：优秀卷，3：典型错误卷）
	 * @param markerId
	 * @return
	 */
	@GetMapping("/exam-score/score/submitNomalTestScore")
	public Map<String,Object> submitNomalTestScore(Integer examId,Integer examSubId,Integer teaId,String teaNm,String topicNo,Double score,Integer scoreId,Long recordId,Integer markerId) {
		Map<String,Object> map = new HashMap<>();
		this.submitTestService.submitNomalTestScore(examId, examSubId, teaId,teaNm, topicNo, score, scoreId, recordId, markerId);
		map.put("code", 1001);
		map.put("msg", "查询成功");
		return map;
	}
	
	/**
	 * 重评卷的提交分数（正常提交）
	 * @param examId
	 * @param examSubId
	 * @param teaId
	 * @param teaNm
	 * @param topicNo
	 * @param score
	 * @param scoreId
	 * @param recordId 试卷的记录类型（0：正常卷，2：优秀卷，3：典型错误卷）
	 * @param markerId
	 * @return
	 */
	@GetMapping("/exam-score/score/submitRepeatTestScore")
	public Map<String,Object> submitRepeatTestScore(Integer examId,Integer examSubId,Integer teaId,String teaNm,String topicNo,Double score,Integer scoreId,Long recordId,Integer markerId) {
		Map<String,Object> map = new HashMap<>();
		this.submitTestService.submitRepeatTestScore(examId, examSubId, teaId,teaNm, topicNo, score, scoreId, recordId, markerId);
		map.put("code", 1001);
		map.put("msg", "查询成功");
		return map;
	}
	
}
